﻿@model ProductModel
@using Telerik.Web.Mvc.UI;
@Html.ValidationSummary(false)
@Html.HiddenFor(model => model.Id)
@Html.Telerik().TabStrip().Name("product-edit").Items(x =>
{
    x.Add().Text(T("Admin.Catalog.Products.Info").Text).Content(TabInfo().ToHtmlString());
    x.Add().Text(T("Admin.Common.SEO").Text).Content(TabSeo().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.Pictures").Text).Content(TabPictures().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.Categories").Text).Content(TabCategories().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.Manufacturers").Text).Content(TabManufacturers().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.SpecificationAttributes").Text).Content(TabSpecificationAttributes().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.ProductVariantAttributes").Text).Content(TabProductAttributes().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.TierPrices").Text).Content(TabTierPrices().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.Discounts").Text).Content(TabDiscounts().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.Acl").Text).Content(TabAcl().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.Stores").Text).Content(TabStores().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.RelatedProducts").Text).Content(TabRelatedProducts().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.CrossSells").Text).Content(TabCrossSells().ToHtmlString());
    x.Add().Text(T("Admin.Catalog.Products.AssociatedProducts").Text).Content(TabAssociatedProducts().ToHtmlString());
    if (Model.Id > 0)
    {
        x.Add().Text(T("Admin.Catalog.Products.PurchasedWithOrders").Text).Content(TabPurchasedWithOrders().ToHtmlString());
    }
    //generate an event
    EngineContext.Current.Resolve<IEventPublisher>().Publish(new AdminTabStripCreated(x, "product-edit"));
}).ClientEvents(events => events.OnSelect("telerik_on_tab_select")).SetSelectedTabIndex(GetSelectedTabIndex())

@*save selected tab index*@
<input type="hidden" id="selected-tab-index" name="selected-tab-index" value="@(GetSelectedTabIndex())">

@helper TabInfo()
{ 
    @Html.Partial("_CreateOrUpdate.Info", Model)
}
@helper TabSeo()
{
    @Html.Partial("_CreateOrUpdate.SEO", Model)
}
@helper TabCategories()
{
    @Html.Partial("_CreateOrUpdate.Categories", Model)
}
@helper TabManufacturers()
{
    @Html.Partial("_CreateOrUpdate.Manufacturers", Model)
}
@helper TabPictures()
{
    @Html.Partial("_CreateOrUpdate.Pictures", Model)
}
@helper TabSpecificationAttributes()
{
    @Html.Partial("_CreateOrUpdate.SpecificationAttributes", Model)
}
@helper TabAcl()
{
    @Html.Partial("_CreateOrUpdate.Acl", Model)
}
@helper TabStores()
{
    @Html.Partial("_CreateOrUpdate.Stores", Model)
}

@helper TabTierPrices()
{
    @Html.Partial("_CreateOrUpdate.TierPrices", Model)
}
@helper TabProductAttributes()
{
    @Html.Partial("_CreateOrUpdate.ProductAttributes", Model)
}
@helper TabDiscounts()
{
    @Html.Partial("_CreateOrUpdate.Discounts", Model)
}
@helper TabRelatedProducts()
{
    @Html.Partial("_CreateOrUpdate.RelatedProducts", Model)
}
@helper TabCrossSells()
{
    @Html.Partial("_CreateOrUpdate.CrossSells", Model)
}
@helper TabAssociatedProducts()
{
    @Html.Partial("_CreateOrUpdate.AssociatedProducts", Model)
}
@helper TabPurchasedWithOrders()
{
    @Html.Partial("_CreateOrUpdate.PurchasedWithOrders", Model)
}

